import http from "@/api";
import { Other, Cost, Tag } from "@/api/interface/province/config";
// 车辆管理模块
// 配置查询接口
export const getOtherListAPI = () => {
  return http.get<Other.Data>("/manager/commonConfig");
};
// 修改接口
export const updateOtherAPI = (data: Other.YyCommonConfig) => {
  return http.post("/manager/commonConfigEdit", data, { loading: false });
};
// 添加重量接口
export const addOtherWeightAPI = (data: Other.UpdateWeight) => {
  return http.post("/manager/deliveryWeight/add", data, { loading: false });
};
// 修改重量接口
export const updateOtherWeightAPI = (data: Other.UpdateWeight) => {
  return http.post("/manager/deliveryWeight/update", data, { loading: false });
};
// 删除重量
export const deleteOtherWeightAPI = (id: number) => {
  return http.delete(`/manager/deliveryWeight/${id}`, { loading: false });
};
// 添加时间接口
export const addOtherTimeAPI = (data: Other.UpdateTime) => {
  return http.post("/manager/deliveryTime/add", data, { loading: false });
};
// 修改重量接口
export const updateOtherTimeAPI = (data: Other.UpdateTime) => {
  return http.post("/manager/deliveryTime/update", data, { loading: false });
};
// 删除时间
export const deleteOtherTimeAPI = (id: number) => {
  return http.delete(`/manager/deliveryTime/${id}`, { loading: false });
};

// 计费配置
// 用户配送费配置列表
export const getCostDeliverAPI = (params: { userType: number }) => {
  return http.get<Cost.DeliverData>("/manager/deliveryFee/consumer", params);
};
// 修改
export const updateCostDeliverAPI = (data: Cost.AddParams) => {
  return http.post("/manager/deliveryFee/consumerEdit", data, { loading: false });
};
// 站长配置列表
export const getCostStationerAPI = () => {
  return http.get<Cost.StationerData>("/manager/commissionDetail", { loading: false });
};
// 修改
export const updateCostStationerAPI = (data: Cost.StationerData) => {
  return http.post("/manager/commissionEdit", data, { loading: false });
};
// 补贴列表
export const getCostSubsidyAPI = (params: { roleId: string }) => {
  return http.get<Cost.SubsidyData[]>("/manager/subsidyList", params);
};
// 修改
export const updateCostSubsidyAPI = (data: Cost.SubsidyData) => {
  return http.post("/manager/subsidyEdit", data, { loading: false });
};
// 删除补贴
export const deleteCostSubsidyAPI = (params: { id: string }) => {
  return http.get(`/manager/subsidyDelete`, params);
};
// 扣减列表
export const getCostDeductionAPI = (params: { roleId: string }) => {
  return http.get<Cost.DedData[]>("/manager/deductionList", params);
};
// 修改
export const updateCostDeductionAPI = (data: Cost.DedData) => {
  return http.post("/manager/deductionEdit", data, { loading: false });
};
// 删除扣减项目
export const deleteCostDeductionAPI = (params: { id: string }) => {
  return http.get(`/manager/deductionDelete`, params);
};

// 评价标签
// 列表
export const getTagListAPI = (data: Tag.SearchParams) => {
  return http.post<Tag.Row[]>("/manager/evaluationLabelList", data, { loading: false });
};
// 查看详情接口
export const getTagDetailAPI = (id: number) => {
  return http.get<Tag.Row>(`/manager/evaluationLabelDetail/${id}`, { loading: false });
};
// 添加接口
export const addTagAPI = (data: Tag.UpdateParams) => {
  return http.post("/manager/evaluationLabelAdd", data, { loading: false });
};
// 修改接口
export const updateTagAPI = (data: Tag.UpdateParams) => {
  return http.post("/manager/evaluationLabelEdit", data, { loading: false });
};
// 删除接口
export const deleteTagAPI = (id: number) => {
  return http.delete(`/manager/evaluationLabelDelete/${id}`, { loading: false });
};
